CC2017 LiDAR
Python • NumPy • SciPy • Matplotlib • LiDAR • Raspberry Pi • Data Analysis • Corner Detection
Jun 2017 - Sep 2017

After the season passed, our team joined some pre-season competitions that used the past competition’s game to help new members learn and get a feel of the workflow of projects. The 2017 FRC Competition, Steamworks, included a boiler at a corner of each side of the game map, and robots can score points by shooting wiffle balls, or “fuel”, into the boiler. My team had just gotten a fairly inexpensive LiDAR, so we wanted to use it to find the corner that the boiler was at and align the robot based on its location. We also wanted to use it to determine the robot’s position on the field in general using SLAM.

Cartesian graph of points detected by the LiDAR

For those who may not know, the LiDAR sensor uses a laser to measure distances. It continuously rotates and measures distances for different angles. We had the Scanse Sweep LiDAR and used their library to operate the LiDAR in our Python scripts. We also used NumPy and SciPy to perform mathematical analysis, and Matplotlib was used to plot graphs, such as for the data and mapping the surroundings of the room. The LiDAR and our Python scripts were run on a Raspberry Pi as we would use one if we added the LiDAR sensor on our robot.

First, we had to be able to detect corners in our surroundings. With the LiDAR, we can get a rough "top-down" view of our surroundings. We converted the data to X-Y coordinates and used linear approximations to find linear sections, which would be potential walls. Since the walls should be linear, the data points should have a constant slope until the LiDAR reaches an obstacle or corner. As such, we used sudden changes in the slopes or derivative to pinpoint where the corners were.

Graph of points of distances and "slope" between points. V's in distance and abnormal slope values were corners.
Graph of area where program determined to contain corner(s)

Next, we had to be able to detect which corner was the boiler. The boiler had a very specific angle, so for each corner, we calculated approximately the angle of the corner, and chose the corner that matched the boiler angle. Since we now knew where the boiler was, we were able to automate robot movement so that the robot and the shooter would be perfectly aligned to the boiler.

Corner determined to be the boiler corner due to wider angle

We also mapped the immediate surroundings of the robot, plotting it on a graph, including the direction and position of the robot in the graph. With this, the driver would have a top-down view of the robot’s surroundings, similar to a mini-map in video games.

In the end, we were successfully able to determine the boiler corner and navigate the robot to align to it. Unfortunately, we were not able to use this in the pre-season competition. We found out, after testing, that the robot was able to navigate to roughly the ideal point, but when the robot was close enough, the LiDAR sensor was not precise enough to have the robot stop at the exact point. If we had a sensor that was more accurate and could take more data points, it would have been better, but what we had was still usable. However, in the end, our team did not successfully build a shooter for the boiler fuel, so the alignment code was not used at all. Even though our analysis code was not used, I was able to learn a lot from this experience, and this ended up being one of my favorite projects in FRC.


©2021 by Julia Shuieh